from django.db import models

# Create your models here.
class user(models.Model):
    # 映射类---包括属性：课程名字、发布时间和学习人数等
    user_id = models.CharField(max_length=64, verbose_name="用户名",primary_key=True,default=0)  # 属性一
    password = models.CharField(max_length=64, verbose_name="密码")  # 属性二
    class Meta:
        db_table = 'userlist'
        verbose_name = '用户列表'
        verbose_name_plural = verbose_name

class search(models.Model):
    id = models.AutoField(primary_key=True)
    user_id = models.ForeignKey(user,on_delete=models.CASCADE)
    keywords = models.CharField(max_length=50, verbose_name="关键词")
    time = models.TimeField(auto_now=True, verbose_name="时间")
    class Meta:
        db_table = 'searchlog'
        verbose_name = '搜索日志'
        verbose_name_plural = verbose_name


class click(models.Model):
    id = models.AutoField(primary_key=True)
    user_id = models.ForeignKey(user,on_delete=models.CASCADE)
    title = models.CharField(max_length=100, verbose_name="标题")
    url = models.CharField(max_length=100, verbose_name="链接")
    time = models.TimeField(auto_now=True, verbose_name="时间")

    class Meta:
        db_table = 'clicklog'
        verbose_name = '点击日志'
        verbose_name_plural = verbose_name